package com.xiaoxiao.regimen.provider;

import android.net.Uri;

/**
 * The contract between the regimen provider and applications. Contains
 * definitions for the supported URIs and columns.
 * 
 * @author jaroad
 *
 */
public final class RegimenContract {
    
    /** The authority for the regimen provider */
    public static final String AUTHORITY = "com.xiaoxiao.regimen";
    
    /** A content:// style uri to the authority for the regimen provider */
    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
    
    protected interface RawRegimenColumns {
        
        /**
         * A reference to the {@link RegimenType#_ID} that this
         * data belongs to.
         * <P>Type: INTEGER</P>
         */
        public static final String REGIMEN_TYPE_ID = "regimen_type_id";
        
        /**
         * The aggregation mode for this regimen.
         * <P>Type: INTEGER</P>
         */
        public static final String AGGREGATION_MODE = "aggregation_mode";
        
        /**
         * The "deleted" flag: "0" by default, "1" if the row has been marked
         * for deletion. When {@link android.content.ContentResolver#delete} is
         * called on a raw regimen, it is marked for deletion and removed from its
         * aggregate regimen.
         * <P>Type: INTEGER</P>
         */
        public static final String DELETED = "deleted";
    }
    
    /**
     * Columns of {@link RawRegimen} that track the user's
     * preferences for, or interactions with, the regimen.
     *
     */
    protected interface RegimenOptionsColumns {
        /**
         * The number of times a regimen has been viewed
         * <P>Type: INTEGER</P>
         */
        public static final String TIMES_VIEW = "times_view";

        /**
         * The last time a regimen was viewed.
         * <P>Type: INTEGER</P>
         */
        public static final String LAST_TIME_VIEW = "last_time_view";
        
        /**
         * URI for a custom ringtone associated with the regimen. If null or missing,
         * the default ringtone is used.
         * <P>Type: TEXT (URI to the ringtone)</P>
         */
        public static final String CUSTOM_RINGTONE = "custom_ringtone";
        
        /**
         * Is the regimen starred?
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String STARRED = "starred";
    }
    
    /**
     * Columns about regimen base info
     * @author jaroad
     *
     */
    protected interface RegimenBaseInfoColumns {
        /**
         * Title of regimen info.
         * <P>Type: TEXT</P>
         */
        public static final String TITLE  = "title";

        /**
         * Title of regimen info.
         * <P>Type: TEXT</P>
         */
        public static final String DESCRIPTION  = "description";

        /**
         * Sort key of regimen info.
         * <P>Type: TEXT</P>
         */
        public static final String SORT_KEY  = "sort_key";

        /**
         * Sort key alt of regimen info.
         * <P>Type: TEXT</P>
         */
        public static final String SORT_KEY_ALT  = "sort_key_alt";

        /**
         * Date of regimen info added.
         * <P>Type: INTEGER</P>
         */
        public static final String DATE = "date";
    }
    
    /**
     * Columns in the Data table.
     *
     * @see Data
     */
    protected interface DataColumns {
        
        /**
         * The MIME type of the item represented by this row.
         */
        public static final String MIMETYPE = "mimetype";
        
        /**
         * A reference to the {@link RawRegimen#_ID}
         * that this data belongs to.
         */
        public static final String RAW_REGIMEN_ID = "raw_regimen_id";
        
        /**
         * The version of this data record. This is a read-only value. The data column is
         * guaranteed to not change without the version going up. This value is monotonically
         * increasing.
         * <P>Type: INTEGER</P>
         */
        public static final String DATA_VERSION = "data_version";

        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA1 = "data1";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA2 = "data2";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA3 = "data3";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA4 = "data4";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA5 = "data5";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA6 = "data6";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA7 = "data7";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA8 = "data8";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA9 = "data9";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA10 = "data10";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA11 = "data11";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA12 = "data12";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA13 = "data13";
        /** Generic data column, the meaning is {@link #MIMETYPE} specific */
        public static final String DATA14 = "data14";
        /**
         * Generic data column, the meaning is {@link #MIMETYPE} specific. By convention,
         * this field is used to store BLOBs (binary data).
         */
        public static final String DATA15 = "data15";

        /** Generic column for use by sync adapters. */
        public static final String SYNC1 = "data_sync1";
        /** Generic column for use by sync adapters. */
        public static final String SYNC2 = "data_sync2";
        /** Generic column for use by sync adapters. */
        public static final String SYNC3 = "data_sync3";
        /** Generic column for use by sync adapters. */
        public static final String SYNC4 = "data_sync4";
        /** Generic column for use by sync adapters. */
        public static final String SYNC5 = "data_sync5";
    }
    
    /**
     * Generic columns for use by sync adapters. The specific functions of
     * these columns are private to the sync adapter. Other clients of the API
     * should not attempt to either read or write this column.
     *
     * @see RawRegimen
     * @see Groups
     */
    protected interface BaseSyncColumns {

        /** Generic column for use by sync adapters. */
        public static final String SYNC1 = "sync1";
        /** Generic column for use by sync adapters. */
        public static final String SYNC2 = "sync2";
        /** Generic column for use by sync adapters. */
        public static final String SYNC3 = "sync3";
        /** Generic column for use by sync adapters. */
        public static final String SYNC4 = "sync4";
        /** Generic column for use by sync adapters. */
        public static final String SYNC5 = "sync5";
    }
    
    /**
     * Columns that appear when each row of a table belongs to a specific
     * account, including sync information that an account may need.
     *
     * @see RawRegimen
     * @see Groups
     */
    protected interface SyncColumns extends BaseSyncColumns {

        /**
         * Version number that is updated whenever this row or its related data
         * changes.
         * <P>Type: INTEGER</P>
         */
        public static final String VERSION = "version";

        /**
         * Flag indicating that {@link #VERSION} has changed, and this row needs
         * to be synchronized.
         * <P>Type: INTEGER (boolean)</P>
         */
        public static final String DIRTY = "dirty";
    }
    
    /**
     * @see Groups
     */
    protected interface GroupsColumns {
        /**
         * The display title of this group.
         * <p>
         * Type: TEXT
         */
        public static final String TITLE = "title";

        /**
         * Notes about the group.
         * <p>
         * Type: TEXT
         */
        public static final String NOTES = "notes";

        /**
         * The total number of {@link RawRegimen} that have
         * {@link GroupMembership} in this group. Read-only value that is only
         * present when querying {@link Groups#CONTENT_SUMMARY_URI}.
         * <p>
         * Type: INTEGER
         */
        public static final String SUMMARY_COUNT = "summ_count";

        /**
         * Flag indicating if the contacts belonging to this group should be
         * visible in any user interface.
         * <p>
         * Type: INTEGER (boolean)
         */
        public static final String GROUP_VISIBLE = "group_visible";

        /**
         * The "deleted" flag: "0" by default, "1" if the row has been marked
         * for deletion. When {@link android.content.ContentResolver#delete} is
         * called on a group, it is marked for deletion.
         * <P>Type: INTEGER</P>
         */
        public static final String DELETED = "deleted";

        /**
         * The "read-only" flag: "0" by default, "1" if the row cannot be modified or
         * deleted except by a sync adapter.
         * <P>Type: INTEGER</P>
         */
        public static final String GROUP_IS_READ_ONLY = "group_is_read_only";
    }
    
    /**
     * @see CustomOptions
     */
    protected interface CustomOptionsColumns {
        /**
         * A reference to the {@link RawRegimen#_ID}
         * that this data belongs to.
         */
        public static final String RAW_REGIMEN_ID = "raw_regimen_id";
    }
    
}
